package com.cuixichang.minimalism.basal.enums;

import com.cuixichang.minimalism.basal.core.BaseDict;

import java.util.Arrays;

public enum SubassemblyTypeEnum implements BaseDict {
    Input{
        @Override
        public String getKey() {
            return "01";
        }

        @Override
        public String getValue() {
            return "输入框";
        }
    },
    TextArea{
        @Override
        public String getKey() {
            return "02";
        }

        @Override
        public String getValue() {
            return "文本框";
        }
    },
    Number{
        @Override
        public String getKey() {
            return "03";
        }

        @Override
        public String getValue() {
            return "数字框";
        }
    },
    Select{
        @Override
        public String getKey() {
            return "04";
        }

        @Override
        public String getValue() {
            return "下拉选择框";
        }
    },
    Checkbox{
        @Override
        public String getKey() {
            return "05";
        }

        @Override
        public String getValue() {
            return "复选框";
        }
    },
    Radio{
         @Override
        public String getKey() {
            return "06";
        }

        @Override
        public String getValue() {
            return "单选框";
        }
    },
    Range{
        @Override
        public String getKey() {
            return "07";
        }

        @Override
        public String getValue() {
            return "滑动模块";
        }
    },
    DateTime{
        @Override
        public String getKey() {
            return "08";
        }

        @Override
        public String getValue() {
            return "日期框";
        }
    },
    DateTimeInterval{
        @Override
        public String getKey() {
            return "09";
        }

        @Override
        public String getValue() {
            return "日期区间";
        }
    },
    Upload{
       @Override
        public String getKey() {
            return "10";
        }

        @Override
        public String getValue() {
            return "文件上传";
        }
    };

    public static SubassemblyTypeEnum getByKey(String key) {
        SubassemblyTypeEnum[] subassemblyTypeEnum = SubassemblyTypeEnum.values();
        return Arrays.stream(subassemblyTypeEnum).filter(item -> item.getKey().equals(key)).findFirst().orElse(null);
    }
}
